package cn.lingyangwl.agile.system.model.rqrs.tenant;

import cn.lingyangwl.agile.model.constants.ValidationCons;
import cn.lingyangwl.agile.model.module.dict.CusFieldBind;
import cn.lingyangwl.agile.model.module.dict.DictTypeCons;
import cn.lingyangwl.agile.system.model.rqrs.role.RoleResp;
import cn.lingyangwl.agile.system.model.rqrs.user.UserBase;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotEmpty;
import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * @author shenguangyang
 */
@Getter
@Setter
@ToString
public class TenantUserResp extends UserBase {
    @ApiModelProperty(value = "唯一标识 tenantId_userId")
    private String id;

    private Long userId;

    @NotEmpty(message = ValidationCons.NOT_EMPTY)
    @ApiModelProperty(value = "用户账号")
    private String userName;

    @ApiModelProperty(value = "帐号状态（1正常 2停用）")
    @CusFieldBind(type = DictTypeCons.USER_STATUS, target = "statusText")
    private String status;
    private String statusText;

    @ApiModelProperty(value = "最后登录IP")
    private String lastLoginIp;

    @ApiModelProperty(value = "最后登录时间")
    private Date lastLoginDate;

    @ApiModelProperty(value = "角色集合")
    private List<RoleResp> roleList = Collections.emptyList();

    @ApiModelProperty(value = "所属租户名称")
    private String tenantName;

    @ApiModelProperty(value = "所属租户ID")
    private String tenantId;

    @ApiModelProperty(value = "被添加到当前租户的时间")
    private Date addTime;

    @ApiModelProperty(value = "是否为所在租户的拥有者")
    private Boolean isOwner;

    @ApiModelProperty(value = "租户访问地址")
    private String tenantUrl;

    public String getId() {
        return tenantId + "_" + userId;
    }
}
